<!doctype html>
<html>
	<head>
  		<meta charset="utf-8">
      	<meta http-equiv="X-UA-Compatible" content="IE=edge">
      	<link rel="shortcut icon" href="favicon.ico"/>
      	<meta http-equiv="cache-control" content="no-cache">
      	<title>填写核对订单信息 - {$CONF['mallTitle']}</title>
      	<meta name="keywords" content="{$CONF['mallKeywords']},填写核对订单信息" />
      	<meta name="description" content="{$CONF['mallDesc']},填写核对订单信息" />
      	<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/common.css" />
     	<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/checkorderinfo.css" />
     	<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/base.css" />
		<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/head.css" />
		<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/magnifier.css" />
      	<style>
      	.adsipt{height:28px;}
		textarea{height:60px;}
      	</style>
   	</head>
   	<body>
	<include file="./Apps/Home/View/default/header_common.html" />
	<div class="w">
        <div>
            <div>
                <div id="succeed">
                    <div class="success2" style="">
                        <div class="wst-chkod-blank"></div>
                        <div class="wst-chkod-step">
                            <img src="__ROOT__/Apps/Home/View/default/images/step2.png"/><br />
                            <span class="wst-chkod-step1">1.我的购物车</span>
                            <span class="wst-chkod-step2">2.填写核对订单信息</span>
                            <span class="wst-chkod-step3">3.成功提交订单</span>
                        </div>
                        <div class="wst-clear"></div>
                    </div>

                </div>
            </div>
            <div id="checkorderInfo">
                <div class="wst-chkod-subox">
                    <div class="wst-chkod-title">
                        	填写并核对订单信息
                    </div>
                    <div>                        
						<div id="consignee1" <if condition="count($addressList) eq 0">style='display:none'</if>>
							<div>
								<span class="wst-chkod-s1-title">收货人信息 </span>
								<input type="hidden" id="paddressId" value="{$addressList[0]['addressId']}"/>
								<span class="wst-chkod-s1-upd"><a href="javascript:toEditAddress();">[修改]</a></span>
							</div>
							<volist name="addressList" key="k" id="address">

								<if condition="$k eq 1">
								<input type="hidden" id="consigneeId" name="consigneeId" value="{$address['addressId']}"/>
								<div id="showaddinfo">										
									<div>
										<span style="font-weight: bold;">{$address["userName"]}&nbsp;&nbsp;&nbsp;&nbsp;</span>
										<if condition="$address['userPhone'] neq ''">
											{$address["userPhone"]}
										<else/>
											{$address["userTel"]}
										</if>
									</div>
									<div>
										{$address["areaName1"]}{$address["areaName2"]}{$address["areaName3"]}{$address["communityName"]}{$address["address"]}&nbsp;&nbsp;&nbsp;&nbsp;
									</div>											
								</div>
								</if>
							</volist>
							<if condition="count($addressList) eq 0">
								<div id="showaddinfo"></div>
								<input type="hidden" id="consigneeId" name="consigneeId" />
							</if>
						</div>
						
                        <div id="consignee2" style="<if condition="count($addressList) gt 0">display:none;</if>">
                            <div>
                                <span class="wst-chkod-cg-title">收货人信息 </span>
                            </div>
                            <div>
                            	<div id="userAddressDiv">
                            	<div id="flagdiv" style="display: none;"></div>
                               	<volist name="addressList" key="key" id="address">
								<div id="caddress_{$address['addressId']}">												
									<label>
										<input id="seladdress_{$address['addressId']}" onclick="changeAddress({$address['addressId']});" name="seladdress" type="radio" <if condition="$key eq 1">checked="checked"</if> value="{$address['addressId']}"/>
										<span style="font-weight: bold;" id="radusername_{$address['addressId']}">{$address["userName"]}&nbsp;&nbsp;&nbsp;&nbsp;</span>
										<span id="radaddress_{$address['addressId']}">
										{$address["areaName1"]}{$address["areaName2"]}{$address["areaName3"]}{$address["communityName"]}{$address["address"]}&nbsp;&nbsp;&nbsp;&nbsp;
										<if condition="$address['userPhone'] neq ''">
											{$address["userPhone"]}
										<else/>
											{$address["userTel"]}
										</if>
										</span>
									</label>
									<span class="optionspan wst-opt-upd">[<a onclick="javascript:editAddress({$address['addressId']});">修改</a>]</span>
									<span class="optionspan wst-opt-del">[<a onclick="javascript:delAddress({$address['addressId']});">删除</a>]</span>									
								</div>
								</volist>
								</div>
								<div>					
									<label>
										<input id="seladdress_0" name="seladdress" type="radio" value="0" onclick="changeAddress(0);" <if condition="count($addressList) eq 0">checked="checked"</if>/>使用新地址
									</label>
								</div>
                            </div>
                            <div id="address_form" style="">
                              
                                <input type='hidden' id='consignee_add_cityName' name='consignee_add_cityName'/>
                                <div class="wst-chkod-line35">
                                    <div class="wst-chkod-cg-pp"><span style="color: red;">*</span>收货人：</div>
                                    <div style="float: left; width: 700px;">
                                        <input type="text" class="input adsipt" style="width: 200px;" maxlength="50" name="consignee_add_userName" id="consignee_add_userName" />&nbsp;
                                    </div>
                                    <div style="clear: both;"></div>
                                </div>
                                <div class="wst-chkod-line35">
                                    <div class="wst-chkod-cg-ads"><span style="color: red;">*</span>收货地址：</div>
                                    <div class="wst-chkod-area-box">
                                    	<select name="consignee_add_provinceId" id="consignee_add_provinceId" class="adsipt" onchange="WST.getAreas('consignee_add_cityId',this.value,'','consignee_add_cityId,consignee_add_countyId,consignee_add_communityId')">
                                            <option value="0" selected="selected">请选择</option>
                                            <volist name="provinces" key="key" id="area">
												<option value="{$area['areaId']}">{$area["areaName"]}</option>
                                            </volist>
                                        </select>
                                        <select name="consignee_add_cityId" id="consignee_add_cityId" class="adsipt" onchange="WST.getAreas('consignee_add_countyId',this.value,'','consignee_add_countyId,consignee_add_countyId,consignee_add_communityId')">
                                            <option value="0" selected="selected">请选择</option>
                                    	</select>
                                        <select name="consignee_add_countyId" id="consignee_add_countyId" class="adsipt"  onchange="loadCommunitys(this.value,0);">
                                            <option value="0" selected="selected">请选择</option>
                                        </select>
                                        <select name="consignee_add_communityId" id="consignee_add_communityId" class="adsipt" onchange="checkArea();">
                                            <option value="0" selected="selected">请选择</option>                                            									
                                        </select>
                                    </div>
                                    <div style="clear: both;"></div>
                                </div>
                                <div class="wst-chkod-line35">
                                    <div class="wst-chkod-cg-pno"><span style="color: red;">*</span>详细地址：</div>
                                    <div class="wst-chkod-cg-pno-box">
                                        <input type="text" class="input adsipt" style="width: 350px;" maxlength="150" name="consignee_add_address" id="consignee_add_address" />&nbsp;
                                    </div>
                                    <div style="clear: both;"></div>
                                </div>
                                <div class="wst-chkod-line35">
                                    <div class="wst-chkod-cg-pno"><span style="color: red;">*</span>手机号码：</div>
                                    <div class="wst-chkod-cg-pno-box">
                                        <input type="text" class="input adsipt" style="width: 150px;" maxlength="11" name="consignee_add_userPhone" id="consignee_add_userPhone" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberdoteKey(event)" />
                                        &nbsp;或&nbsp;&nbsp;&nbsp;&nbsp;
										 固定电话:<input type="text" class="input adsipt" style="width: 150px;" maxlength="15" name="consignee_add_userTel" id="consignee_add_userTel" />(例：020-88888888)&nbsp;
                                    </div>
                                    <div style="clear: both;"></div>
                                </div>
                                <div class="wst-chkod-line35">
                                    <div class="wst-chkod-cg-pno"><span style="color: red;">*</span>是否默认地址：</div>
                                    <div class="wst-chkod-cg-pno-box">
                                        <label>
                                          <input type='radio' name='consignee_add_isDefault' id='consignee_add_isDefault_1' vallue='1'>是
                                        </label>
                                        <label>
                                          <input type='radio' name='consignee_add_isDefault' id='consignee_add_isDefault_0' vallue='0'>否
                                        </label>
                                    </div>
                                    <div style="clear: both;"></div>
                                </div>
                            </div>
                            
							<div class="wst-checkout wst-chkod-sbx" id="checkout">
								<li  onclick="saveAddress()">
									<span id="saveConsigneeTitleDiv"></span>
								</li>
								<div style="clear: both;"></div>
							</div>
                        </div>
                    </div>
                    <div class="wst-chkod-pay">
                        <div>
                            <span class="wst-chkod-pay-tt">支付方式 </span>
                        </div>
                        <div id="newaddress">
                        	<?php if($distCnt==0){ ?>
                        	<if condition="count($payments['unlines']) gt 0">
                            <div>
                                <div style="width:200px;float:left;">
                                	<label>
                                    	<input id="pay_hd" name="payway" checked="checked" type="radio" value="0" />货到付款
                                    </label>
                                </div>
                                <div style="width:800px;float:left;">
                                	<span class="wst-chkod-sh-tips">送货上门后再收款，支持现金</span>
                                </div>
                                <div style="clear:both;"></div>
                            </div>
                            </if>
                            <?php } ?>
                            <if condition="count($payments['onlines']) gt 0">
                            <div>
                                <div style="width:200px;float:left;">
                                	<label>
                                    	<input id="pay_ali" name="payway" type="radio" value="1" />在线支付
                                    </label>
                                </div>
                                <div style="width:800px;float:left;">
                                	
                                	<div><span class="wst-chkod-sh-tips">可在提交订单后选择，支持：</span></div>
                                	<volist name="payments['onlines']" key="key" id="payment">
                                		<if condition="$payment['isOnline'] eq 1">
                                		<div style="float:left;width:165px;"><img src="__ROOT__/{$payment['payIcon']}" width="120" height="45"/></div>
                                		</if>
                                	</volist>
                                	<div style="clear:both;"></div>
                                </div>
                                <div style="clear:both;"></div>
                            </div>
                            </if>
                        </div>
                    </div>
                    <div class="wst-chkod-dp-box">
                        <div>
                            <span class="wst-chkod-dp-hds">发票信息 </span>
                        </div>
                        <div style="padding-left: 40px;">
                            <label>
                                <input id="receipt_1" name="needreceipt" type="radio" value="1" />需要开发票
                            </label>
                            <div id="invoiceClientdiv" style="display: none;">
                                	抬头：<input id="invoiceClient" name="invoiceClient" />
                            </div>
                        </div>
                        <div style="padding-left: 40px;">
                            <label>
                                <input id="receipt_2" name="needreceipt" checked="checked" type="radio" value="0" />不需要开发票
                            </label>
                        </div>
                    </div>
                    <div class="wst-chkod-dp-box">
                        <div>
                            <span class="wst-chkod-dp-hds">送货方式</span>
                        </div>
                        <div style="padding-left: 40px;">
                            <label>
                                <input id="isself_0" name="isself" checked="checked" type="radio" value="0" />送货上门
                            </label>
                        </div>
                        <div style="padding-left: 40px;">
                            <label>
                                <input id="isself_1" name="isself" type="radio" value="1" />自提 
                            </label>
                        </div>
                    </div>
                    <div class="wst-chkod-dp-box">
                        <div>
                            <span class="wst-chkod-dp-hds">送达时间</span>
                        </div>
                        <div style="padding-left: 40px;">
                            <label>
                               	 期望送达时间:
                            </label>
                            
                            <select id="requestdate" class="adsipt" onchange="changeRequestdate();">
                            </select>
                            <select id="requesttime" class="adsipt" >
                            </select> 
                        </div>
                    </div>
                    <div class="wst-chkod-dp-box">
                        <div>
                            <span class="wst-chkod-dp-hds">订单备注<span style="font-weight: normal;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
                        </div>
                        <div style="padding-left: 40px;">
                            <label>
                               	<textarea id="remarks" name="remarks" rows="2" cols="100" maxlength="50"></textarea>
                            </label>                           
                        </div>
                    </div>
                    <div class="wst-chkod-dp-box">
                        
                        <volist name="catgoods" key="key" id="shopgoods">						
							<div>
                                <div class="wst-chkod-dp-pb1">
                                    <span class="wst-chkod-dp-hds">商品清单</span><span class="wst-chkod-shop-span">【<span id="sp_{$shopgoods['shopgoods'][0]['shopId']}">{$shopgoods["shopName"]}</span><if condition='$shopgoods["isInvoice"] eq 1'>：本店可开具发票<else/>：不可开发票</if>】</span>
                                	<if condition="$shopgoods['shopgoods'][0]['qqNo'] neq ''">
										<a href="tencent://message/?uin={$shopgoods['shopgoods'][0]['qqNo']}&Site=QQ交谈&Menu=yes">
											<img border="0" src="http://wpa.qq.com/pa?p=1:{$shopgoods['shopgoods'][0]['qqNo']}:7" alt="QQ交谈" width="71" height="24" />
										</a>
									</if>
                                </div>
                                <div class="wst-goods-tips">
                                	<if condition="$shopgoods['shopgoods'][0]['shopAtive'] eq 0">
			                 		<span class="label-warning">&nbsp;休息中&nbsp;</span>&nbsp;
			                 		</if>
                                   	 包邮起步价：¥{$shopgoods["deliveryFreeMoney"]}元
                                </div>
                                <div style="clear: both;"></div>
                            </div>
                            <if condition='$shopgoods["deliveryStartMoney"] gt $shopgoods["totalMoney"]'>
                            	<div id="showwarnmsg_{$key}" class="wst-chkod-dp-pb2">
			                		抱歉，您的订单金额未达到该店铺的配送订单起步价¥{$shopgoods["deliveryStartMoney"]}元，不能提交订单。
			                	</div>
			                	<input type="hidden" id="tst_{$key}"  class="tst" value="-1"/>
                            </if>                            
                        <div>
                            <div class="wst-chkod-glist-tb">
                                <div class="wst-chkod-glist-tt1">&nbsp;&nbsp;商品</div>
                                <div class="wst-chkod-glist-tt2">商品单价</div>
                                <div class="wst-chkod-glist-tt3">数量</div>
                                <div class="wst-chkod-glist-tt4">总价</div>
                                <div class="wst-chkod-glist-tt5">库存状态</div>
                                <div class="wst-clear"></div>
                            </div>
                            <volist name="shopgoods['packages']" key="key2" id="package">
                            	<div class="selgoods" class="wst-chkod-dp-pb3">
                            		
                                    <div class="wst-chkod-dp-pb4">
                                    	<div style="color: #e43e41;font-weight: bold; ">{$package['packageName']}</div>
                                    	<volist name="package['goods']" key="key2" id="goods">
                                        <div>
                                            <div class="wst-cart-goods-img">
                                                <a href="{:U('Home/Goods/getGoodsDetails/',array('goodsId'=>$goods['goodsId']))}" target="_blank">
                                                    <img src="__ROOT__/{$goods['goodsThums']}" width="60" height="60" /></a>
                                            </div>
                                            <div class="wst-cart-goods-name">
                                                <a target="_blank" href="{:U('Home/Goods/getGoodsDetails/',array('goodsId'=>$goods['goodsId']))}" target="_blank">
                                                {$goods["goodsName"]}<if condition="$goods['attrVal'] neq ''">【{$goods['attrName']}:{$goods['attrVal']}】</if>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="wst-clear"></div>
                                        </volist>
                                    </div>
                                    
                                    <div class="wst-chkod-od-crt1">
                                   	 	¥{$package["shopPrice"]}元
                                   	 	<volist name="package['goods']" key="key2" id="goods">
				                            <div style="height:58px;line-height:20px;">
				                               <div style="margin-top:4px;">¥{$goods["shopPrice"]}元</div> 
				                               <div style="text-decoration:line-through;color:#666666;">¥{$goods["oshopPrice"]}元</div> 
				                            </div>
				                            <div class="wst-clear"></div>
			                            </volist>
                                    </div>
                                    <div class="wst-chkod-od-crt2">{$package['goodsCnt']}</div>
                                    <div class="wst-chkod-od-crt3">¥{$package["shopPrice"]*$package['goodsCnt']}元</div>
                                    <div class="wst-chkod-od-crt4">
	                                    <if condition="$package['goodsStock'] egt $package['goodsCnt']">
	                                    	有货
	                                    <elseif condition="$package['goodsStock'] eq 0"/>
	                                    	<span style="color:red;">无货</span>
	                                    <else>
	                                    	<span style="color:red;">库存不足,仅剩{$package["goodsStock"]}份</span>
	                                    </if>
                                    </div>
                                    <div class="wst-clear"></div>
                                </div>
                            </volist>
                            <volist name="shopgoods['shopgoods']" key="key2" id="goods">
								<div class="selgoods" class="wst-chkod-dp-pb3">
                                    <div class="wst-chkod-dp-pb4">
                                        <div>
                                            <div class="wst-cart-goods-img">
                                                <a href="{:U('Home/Goods/getGoodsDetails/',array('goodsId'=>$goods['goodsId']))}" target="_blank">
                                                    <img src="__ROOT__/{$goods['goodsThums']}" width="60" height="60" /></a>
                                            </div>
                                            <div class="wst-cart-goods-name">
                                                <a target="_blank" href="{:U('Home/Goods/getGoodsDetails/',array('goodsId'=>$goods['goodsId']))}" target="_blank">
                                                {$goods["goodsName"]}<if condition="$goods['attrVal'] neq ''">【{$goods['attrName']}:{$goods['attrVal']}】</if>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="wst-chkod-od-crt1">¥{$goods["shopPrice"]}元</div>
                                    <div class="wst-chkod-od-crt2">{$goods['cnt']}</div>
                                    <div class="wst-chkod-od-crt3">¥{$goods["shopPrice"]*$goods['cnt']}元</div>
                                    <div class="wst-chkod-od-crt4">
	                                    <if condition="$goods['goodsStock'] egt $goods['cnt']">
	                                    	有货
	                                    <elseif condition="$goods['goodsStock'] eq 0"/>
	                                    	<span style="color:red;">无货</span>
	                                    <else>
	                                    	<span style="color:red;">库存不足,仅剩{$goods["goodsStock"]}份</span>
	                                    </if>
                                    </div>
                                    <div class="wst-clear"></div>
                                </div>
                            </volist>													
                        </div>
                        <div class="wst-chkod-dp-pb5">
                            <div style="width: 310px; float: right;">
                                <div>
                                    <div class="wst-chkod-my1"><span style="color: red;">{$shopgoods["totalCnt"]}</span> 件商品，总商品金额：</div>
                                    <div class="wst-chkod-my2">¥{$shopgoods["totalMoney"]}&nbsp;&nbsp;</div>
                                    <div class="wst-clear"></div>
                                </div>
                                <div>
                                    <div class="wst-chkod-yy1">运费：</div>
                                    <div class="wst-chkod-yy2">
                                    	<input type="hidden" id="deliveryMoney_{$key}" value='<if condition='$shopgoods["totalMoney"] lt $shopgoods["deliveryFreeMoney"]'>¥{$shopgoods["deliveryMoney"]}<else/>免运费</if>'/>

                                    	<span id="deliveryMoney_span_{$key}">
                                    	<if condition='$shopgoods["totalMoney"] lt $shopgoods["deliveryFreeMoney"]'>¥{$shopgoods["deliveryMoney"]}<else/>免运费</if>
                                   	 	</span>
                                   	&nbsp;&nbsp;</div>
                                    <div class="wst-clear"></div>
                                </div>
                            </div>
                            <div class="wst-clear"></div>
                        </div>
                        </volist>	
                    </div>
                    <?php if($CONF['isOpenScorePay']==1){ ?>
                    <div id="wst-scorebox">
                    	<div class="leftbox">
				   		<if condition="$canUserScore eq 0">本次不符合积分使用规则，无可用积分<br/></if>
						共{$userScore}个积分，本次可用 <span id="canUserScore" data="{$canUserScore}" style="color:red;">{$canUserScore}</span> 个积分，<span id="scoreRule" onmouseover="showScoreRule()" onmouseout="closeScoreRule()" style="cursor: pointer;"><img src="__ROOT__/Apps/Home/View/default/images/a5.jpg"/> 积分规则</span>
						</div>
						<div class="rightbox">
							<if condition="$canUserScore gt 0">
							<label id="scorePayLab"><input id="isScorePay" type="checkbox" scoreMoney="{$scoreMoney}" totalMoney="{$totalMoney}" gtotalMoney="{$gtotalMoney}" />使用积分支付 ￥<span id="scoreMoney">{$scoreMoney}</span></label>
							</if>
						</div>
						<div style="clear:both"></div>
                    </div>
                    <?php } ?>
                    <div class="checkout-buttons group" id="checkout-floatbar">
                        <div class="wst-chkod-yf1">
                        	<span class="total">应付总额：<span style="color: red;">
	                                <strong id="payPriceId">￥
	                                	<input type="hidden" id="gtotalMoney" value="{$gtotalMoney}"/>
	                                	<input type="hidden" id="totalMoney" value="{$totalMoney}"/>
		                                <span id="totalMoney_span">{$totalMoney}</span>
	                                </strong>元</span>
                                </span>
                        </div>
                        <if condition="$CONF['isOrderScore'] eq 1">
                    	<div class="wst-chkod-yf1">                                           
                                                                   可获得积分：<?php echo floor($gtotalMoney)?> 个
                      	</div>
                      	</if>
                        <div class="sticky-wrap">
                            <div class="wst-inner">
                            <button onclick="javascript:backCart();" class="wst-prev-btn">返回上一步</button>
                          	<button class="wst-next-btn" onclick="javascript:submitOrder();" id="order-submit" class="checkout-submit" type="submit" >提交订单</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
	    </div>
	    <div style="clear: both;"></div>
	    <div style="height: 20px;"></div>
		<include file="./Apps/Home/View/default/footer.html" />
	</body>
	<script type="text/javascript">
	var layerId = 0;
	function showScoreRule(){
		layerId = layer.tips('积分满 {:WSTOrderScore()} 即可使用：每次使用积分为 n*{:WSTOrderScore()}', '#scoreRule', {
			  tips: [1, '#87d7f5'],
			  time: 100000
		});
	}
	function closeScoreRule(){
		layer.close(layerId);
	}
	
	function subCheckArea(){
	    var communityId = $("#consignee_add_communityId").val();
	    <volist name="shopColleges" id="shopCollege">
		    <if condition="$distributAll[$key] eq 1">
				$("#areaOk").val("1");
			<else/>
				var shopCollege = ',{$shopCollege},';
				var idx = shopCollege.indexOf(","+communityId+",");
				if(idx==-1){
					$("#areaOk").val("0");	
					WST.msg("店铺“"+$("#sp_{$key}").html()+"”中的商品不在配送区域内！");
					return false;
				}else{
					$("#areaOk").val("1");
				}
			</if>
		</volist>
	 	return true;
	}
	function checkArea(obj){
		var communityId = $("#consignee_add_communityId").val();
		<volist name="shopColleges" id="shopCollege">
			var shopCollege = ',{$shopCollege},';					
			var idx = shopCollege.indexOf(","+communityId+",");
			<if condition="$distributAll[$key] eq 1">
				$("#areaOk").val("1");
			<else/>
				if(idx==-1 && {$key}!=1){
					$("#areaOk").val("0");
					WST.msg("店铺“"+$("#sp_{$key}").html()+"”中的商品不在配送区域内！");
					return false;
				}else{
					$("#areaOk").val("1");
				}
			</if>
		</volist>
		return true;
	}
	
	
	$(function(){
		var myDate = new Date();
	    var currHour = myDate.getHours();
	    var currMinutes = myDate.getMinutes();
	    var currdayFlag = true;           
	
	    var html = new Array();
	    $("#requesttime").empty();		
		var startNum = currHour*4+(Math.ceil(currMinutes/15))+4;
		
		if(startNum<{$startTime}){
			startNum = {$startTime};
		}
		
		if(startNum<96){
			for(var i=startNum;i<={$endTime};i++){
				if(times[i]){
	                html.push('<option id="'+times[i]+'">'+times[i]+'</option>');   
				}
	        }
		}
		var daymark = 0;
		if(html.length==0){
			 daymark = 1;
					 
		}
		
	    $("#requesttime").html(html.join(""));
	    var html2 = new Array();
	    for(var i=daymark;i<3+daymark;i++){
	        var cdate = addDate(i);  
	       
	        html2.push('<option id="'+cdate+'">'+cdate+'</option>');
	    }
	    $("#requestdate").html(html2.join(""));    
	    
	    if(html.length==0){			
			 changeRequestdate();			 
		}else{
			$("#requesttime").html(html.join(""));
		}
	});
		 
	function changeRequestdate(){
		var html = new Array();
	 	$("#requesttime").empty();
	 	var requestdate = $("#requestdate").val();
	 	
	 	var d=new Date();   
	 	var currHour = d.getHours();
		var currMinutes = d.getMinutes();
	   	var m=d.getMonth()+1;
	   	var currDate = d.getFullYear()+'-'+(m>=10?m:'0'+m)+'-'+(d.getDate()>=10?d.getDate():"0"+d.getDate());
	   	var startNum = 0;

	   	if(currDate == requestdate){
	   		
	   		var startNum = currHour*4+(Math.ceil(currMinutes/15))+4;
			if(startNum<{$startTime}){
				startNum = {$startTime};
			}
	 	}
	 
		for(var i=startNum;i<=96;i++){ 	
			if(times[i]){	
	      		html.push('<option id="'+times[i]+'">'+times[i]+'</option>');
	   		}       
	   	}
		$("#requesttime").html(html.join(""));
	}
		
	function backCart(){
		location.href="{:U('Home/Cart/getCartInfo/',array('rnd'=>rand(100000000,999999999)))}";
	}
	
	var times = ["00:00","00:15","00:30","00:45",
	             "01:00","01:15","01:30","01:45",
	             "02:00","02:15","02:30","02:45",
	             "03:00","03:15","03:30","03:45",
	             "04:00","04:15","04:30","04:45",
	             "05:00","05:15","05:30","05:45",
	             "06:00","06:15","06:30","06:45",
	             "07:00","07:15","07:30","07:45",
	             "08:00","08:15","08:30","08:45",
	             "09:00","09:15","09:30","09:45",
	             "10:00","10:15","10:30","10:45",
	             "11:00","11:15","11:30","11:45",
	             "12:00","12:15","12:30","12:45",
	             "13:00","13:15","13:30","13:45",
	             "14:00","14:15","14:30","14:45",
	             "15:00","15:15","15:30","15:45",
	             "16:00","16:15","16:30","16:45",
	             "17:00","17:15","17:30","17:45",
	             "18:00","18:15","18:30","18:45",
	             "19:00","19:15","19:30","19:45",
	             "20:00","20:15","20:30","20:45",
	             "21:00","21:15","21:30","21:45",
	             "22:00","22:15","22:30","22:45",
	             "23:00","23:15","23:30","23:45"];
function addDate(days){
    var d=new Date();
    d.setDate(d.getDate()+days);
    var m=d.getMonth()+1;
    return d.getFullYear()+'-'+(m>=10?m:'0'+m)+'-'+(d.getDate()>=10?d.getDate():"0"+d.getDate());
} 
$(document).ready(function(){
	$('#seladdress_{$addressList[0]["addressId"]}').click();
});
</script>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__ROOT__/Apps/Home/View/default/js/index.js"></script>
<script src="__ROOT__/Apps/Home/View/default/js/common.js"></script>
<script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
<script src="__ROOT__/Apps/Home/View/default/js/orders.js"></script>
</html>
